<?php
require_once 'data/data.php';
$data = query('select id,email,user_name,(year(now()) - year(birthday)) as age, birthday,gender,cuorses from users');
?>

<!DOCTYPE html>
<html>
<head>
   <title>index</title>
   <style type="text/css">
       body {
         margin: 0;
         font-family: "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Helvetica, Arial, sans-serif;
         font-size: 14px;
         color: #777; 
       	}

       	#wrapper{
       	 width: 90%;
       	 min-height: 290px;
       	 margin: 0 auto;
       	 padding-top: 10px;
       	}

       	#wrapper table,#wrapper table th,#wrapper table td{
         border: 1px solid #ccc;
         border-collapse: collapse;
         border-spacing: 0;
        }

        #wrapper table{
         width: 100%;
           margin: 0 auto;
        }

        #wrapper table tr{
          height: 40px;         
        }

        #wrapper table th{
          font-size: 16px;
          font-weight: bolder;
          color: #222;
          background: #f7f7f7;
        }

        #wrapper table td{
          text-align: center;
        }

        #wrapper table .data-row:hover{
           background: #e9e9e9;
        }
        #style{
        	width: 80px;
        	height: 30px;
        	background: #888;
        	border-radius: 5px;
        	margin: 5px;

        }
        #style a{
        	display: block;
        	text-decoration: none;
        	text-align: center;
        	padding: 5px;
        	color: #f6f6f6;
        }


      </style>
</head>
<body>
 <div id="wrapper">
   <div id="style"><a href="user_info.php?op=1">增加新用户</a></div>
  <table>
     <tr>
       <th>id</th>
       <th>email</th>
       <th>username</th>
       <th>age</th>
       <th>birth</th>
       <th>gender</th>
       <th>cuorses</th>
       <th>actions</th>
     </tr>
   
     <?php foreach ($data as $row): ?>
      <tr class="data-row">
        <td><?=$row['id']?></td>
        <td><?=$row['email']?></td>
        <td><?=$row['user_name']?></td>
        <td><?=$row['age']?></td>
        <td><?=$row['birthday']?></td>
        <td><?=$row['gender']?></td>
        <td><?=$row['cuorses']?></td>
        <td>
          <a href="user_info.php?op=2 & id= <?= $row['id'] ?>">编辑</a>
          <a href="action/delete.php ? id= <?= $row['id'] ?>">删除</a>
        </td>
      </tr>
      <?php endforeach; ?>
  </table>
 </div>

</body>
</html>